1. Field of the Invention
The present invention relates to the technique of managing the state of communication with an external device by an application executed on a mobile computer.
2. Description of the Related Art
An operating system configured to execute a plurality of applications while the execution state of each application shifts among a foreground state, a background state, and a suspended state has been known as an operating system for a multitasking mobile computer (see, e.g., Japanese Patent Laid-Open No. 2006-209560).
The foreground state described herein indicates the state in which the application is executed while processing such as display in a window and reception of a user operation is available with a user interface being activated. The background state described herein indicates the state in which the application is executed while the user interface is inactivated. The suspended state described herein indicates the state in which the application is loaded, but the code thereof is inexecutable.
The application to be executed in the foreground state is limited to a single application, and for example, the execution state of each application is controlled as follows by the operating system. That is, depending on, e.g., the user operation, the operating system switches the application targeted for the foreground state. Moreover, when the operating system switches the application targeted for the foreground state, the operating system shifts the execution state of the application having been executed in the foreground state to the background state. In addition, the operating system shifts the execution state of the application, not performing continuous processing in the background state, to the background state, and then shifts the execution state of such an application to the suspended state by a predetermined trigger such as a lapse of a predetermined period of time.
Suppose that the application executed on the operating system configured to shift the execution state of each application among the foreground state, the background state, and the suspended state as described above performs, in the foreground state, processing using a communication connection established between the application and an external device. In this case, the following disadvantage may arise.
That is, even after the application performing processing using the communication connection established between the application and the external device in the foreground state shifts from the foreground state to the background state, the connection state of the communication connection is maintained. Thus, the application continues to manage the connection state of the communication connection as being an active state. Subsequently, when the application shifts from the background state to the suspended state, the application becomes inexecutable in the suspended state, and therefore, the communication connection managed by the application is, during the period of the suspended state, put on hold with the connection state thereof being the active state.
Meanwhile, in shifting the application from the background state to the suspended state, for example, the application substantially enters an inoperable state or becomes inoperable on the external device, and therefore, the communication connection used by the application may be cut off by the external device or the operating system. In this case, after the application shifts from the suspended state to the background state or the foreground state, inconsistency occurs when the application recognizes the connection state of the communication connection as being the active state in spite of the communication connection being cut off. Such inconsistency may lead to erroneous operation of the application.
The present disclosure is intended to use an application shifting among a foreground state, a background state, and a suspended state and performing, in the foreground state, processing using a communication connection established between the application and an external device to properly manage the connection state of the communication connection.